#ifndef DRAWTHREAD_H
#define DRAWTHREAD_H

#include <QThread>
#include <QVariantList>
#include "pictureitem.h"

class QImage;
class QPainter;

class DrawThread : public QThread
{    
    Q_OBJECT
public:
    explicit DrawThread(QString picturesHome, QMap<PictureItem::ImageSizes,QStringList> resolutions);
    ~DrawThread();

    void createImage(PictureItem::ImageTypes imageType, PictureItem::ImageSizes imageSize,
                     QVariantList imageList, QString fileName,
                     QColor background, QColor backgroundOld,int margin, int aspectRatio);

    bool success() const{return m_success;}

    void stopWorking();

    bool stopRequested();

    QString filename();

protected:
    void run();    

private:
    QImage* scaledImage(int index);

public slots:

private:
    PictureItem::ImageTypes                      m_imageType;
    PictureItem::ImageSizes                      m_imageSize;
    QVariantList                    m_imageList;
    QString                         m_fileName;
    QColor                          m_background;
    QColor                          m_backgroundOld;
    int                             m_margin;
    QString                         m_emptyName;
    QString                         m_picturesHome;
    QMap<PictureItem::ImageSizes,QStringList >   m_resolutions;
    bool                                        m_success;
    QImage*                                     m_final;
    QPainter*                                   m_combiner;
    bool                                        m_requestStop;
    int                                         m_aspect;
};

#endif // DRAWTHREAD_H
